<template>
<div class="mui-numbox" data-numbox-min='1' :data-numbox-max='max'>
<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
<input id="test" class="mui-input-numbox" type="number" value="1" ref="nobox" @change="countChanged" />
<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
</div>
</template>


<script>
import mui from "../../../lib/mui/js/mui.js";
export default {
  data() {
    return {};
  },
  methods: {
    countChanged() {
      const val = this.$refs.nobox.value;
      this.$emit("func", parseInt(val));
      console.log(val);
    }
  },
  props: ["max"],
  watch: {
    max: function(newval, oldval) {
      console.log(newval);

      mui(".mui-numbox")
        .numbox()
        .setOption("max", newval);
    }
  },
  mounted() {
    mui(".mui-numbox").numbox();
  }
};
</script>


<style lang="scss" scoped>

</style>


